#pragma once

#include <string>
#include <optional>

namespace git
{

class CertRequest
{
public:
    CertRequest(const char *url, const char *usernameFromUrl, int allowedTypes);

    bool allowUserpass() const;

    bool allowSsh() const;

    const std::string *url() const {
        if (url_) {
            return &(url_.value());
        } else {
            return nullptr;
        }
    }

    const char *usernameFromUrl() const {
        if (usernameFromUrl_) {
            return usernameFromUrl_.value().c_str();
        } else {
            return nullptr;
        }
    }

private:
    std::optional<std::string> url_;
    std::optional<std::string> usernameFromUrl_;
    int allowedTypes_;
};

} // namespace git
